<!DOCTYPE html>
<html lang="en">
    <head>
        <meta charset="UTF-8">
        <meta content="width=device-width, initial-scale=1.0, maximum-scale=1.0,user-scalable=no" name="viewport" />
        <meta content="yes" name="apple-mobile-web-app-capable" />
        <meta content="yes" name="apple-touch-fullscreen" />
        <meta content="telephone=no" name="format-detection" />
        <meta content="black" name="apple-mobile-web-app-status-bar-style">
        <!-- <title>公益捐物</title> -->

        <link href="__PUBLIC__/css/layui.css" rel="stylesheet" type="text/css" media="all"/>
        <script type="text/javascript" src="__PUBLIC__/layui.js"></script>

        <link rel="stylesheet" href="__PUBLIC__/home/css/mlogin.min.css">
    </head>
    
    <body>
        <div class="banner-section">
                <img src="__PUBLIC__/home/images/da.jpg" class="banner-img" style="width: 100%;">
        </div>
        <section class="page">
        <form class="layui-form" method="post">
            <div class="wrap loginPage">
                <div class="input-container" style="border: 0px;">
                    <span>手机登陆</span>
                    <i class="icon icon-clear"></i>
                </div>
                <div class="input-container" style="padding-left: 15%">
                    <div class="txt-password">手机号：</div>
                    <input class="acc-input password txt-input J_ping" type="text" name="phone" lay-verify="phone" placeholder="请输入联系人手机" autocomplete="off">
                    <i class="icon icon-clear"></i>
                </div>
                <div class="input-container" style="padding-left: 15%">
                    <div class="txt-password">密 &nbsp; 码：</div>
                    <input class="acc-input password txt-input J_ping" type="password" name="password" lay-verify="password" placeholder="请输入密码" autocomplete="off">
                    <i class="icon icon-clear"></i>
                </div>
                <div style="text-align: left;height: 20px;">
                    <i class="icon icon-clear"></i>
                </div>
                
                <p style="padding: 15px;font-size: 8px;height: 5px;">
                  <a href="{:U('user/zhuce')}" style="position: absolute;left: 20px;">立即注册</a>
                  <a href="{:U('user/pass')}" style="position: absolute;right: 20px;">忘记密码</a>
                </p>

                <button lay-submit="" lay-filter="*" style="background-color: #EBA524;color: #fff;width: 100%;height: 46px;border:0px;" id="tijiaobtn">登陆</button>
                
            </div>
        </form>
        </section>
<script type="text/javascript">
    layui.use(['form','layer'], function(){
       $ = layui.jquery;
      var layer = layui.layer
      ,form = layui.form();
      //layer.msg('Hello World');
    //自定义验证规则
    form.verify({
      phone: function(value){
        if(value.length < 1){
          return '请输入手机号';
        }
      }
      ,password: function(value){
        if(value.length < 1){
          return '请输入密码';
        }
      }
    });

      //交互
    form.on('submit(*)', function(data){
        $.ajax({
            url: "{:U('user/login')}",//请求地址
            type: "post",//请求方式
            dataType: "json",//返回数据类型
            data: data.field,//发送的参数
            })
            .done(function(response) {
                  if(response.error==0){
                     layer.msg(response.info ,{icon:5});
                  }else{
                     layer.msg(response.info ,{icon:6});
                     location.href = response.url;
                  }
              })
            .fail(function() {
                alert("ajxs交互失败");
            })  

          return false; //阻止表单跳转。如果需要表单跳转，去掉这段即可。
        });   
    });

</script>
    </body>
</html>